package com.example.mall.search.builder;

public class Person {

    private Long id;

    private String name;

    private Integer age;

    private String desc;

    private Person(Builder builder) {
        this.id = builder.id;
        this.name = builder.name;
        this.age = builder.age;
        this.desc = builder.desc;
    }

    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", desc='" + desc + '\'' +
                '}';
    }

    public static class Builder {

        private final Long id;
        private final String name;

        private Integer age;
        private String desc;

        public Builder(Long id, String name) {
            this.id = id;
            this.name = name;
        }

        public Builder age(Integer age) {
            this.age = age;
            return this;
        }

        public Builder desc(String desc) {
            this.desc = desc;
            return this;
        }

        public Person build() {
            return new Person(this);
        }
    }
}
